package org.school.streaming.io;

import java.io.FileInputStream;

/**
 * This class represents a VideoStream
 * @author Davin
 * 
 */
public class VideoStream
{
	/*
	 * This FileInputStream contains the stream on which the VideoStream is based on 
	 */
	private FileInputStream fis;
	//private int frameNr;
	
	/*
	 * Constructor
	 * @param filename Location of file to base VideoStream on
	 */
	public VideoStream( String filename ) throws Exception
	{
		fis = new FileInputStream( filename );
		//frameNr = 0;
	}
	
	/* Returns next frame number of VideoStream
	 * @param frame ????
	 */
	public int getNextFrame( byte[] frame ) throws Exception
	{
		int length = 0;
		String lengthString;
		byte[] frameLength = new byte[5];
		
		fis.read( frameLength, 0, 5 );
		
		lengthString = new String( frameLength );
		length = Integer.parseInt( lengthString );
		
		return fis.read( frame, 0, length );
	}
}
